<%@ taglib prefix="s" uri="/struts-tags"%>



<s:url id="editProfileInputUrlId" action="editProfileInput"
	namespace="/">
	<s:param name="userId">
		<s:property value="profileBean.userId"></s:property>
	</s:param>
</s:url>
<s:url id="editPasswordInputUrlId" action="editPasswordInput"
	namespace="/">
	<s:param name="userId">
		<s:property value="profileBean.userId"></s:property>
	</s:param>
</s:url>
<s:url id="deleteProfileUrlId" action="deleteProfile" namespace="/">
	<s:param name="userId">
		<s:property value="profileBean.userId"></s:property>
	</s:param>
</s:url>
<div style="margin-top: 5px; margin-bottom: 15px">
<h2 style="display: inline"><s:text name="profile.header"></s:text></h2>
<div style="float: right"><s:if
	test="#session.loginToken.rights.contains('profile_edit') || #session.loginToken.rights.contains('user_edit')">
	<s:a href="%{editProfileInputUrlId}"
		title="%{getText('profile.editProfile')}">
		<img src="image/icons/0037_notepad.png" width="24" height="24"
			alt="edit" border="0">
	</s:a>
</s:if> <s:if
	test="#session.loginToken.rights.contains('profile_edit') || #session.loginToken.rights.contains('user_edit')">
	<s:a href="%{editPasswordInputUrlId}"
		title="%{getText('profile.editPassword')}">
		<img src="image/icons/0027_key.png" width="24" height="24"
			alt="editPassword" border="0">
	</s:a>
</s:if> <s:if
	test="#session.loginToken.rights.contains('profile_delete') || #session.loginToken.rights.contains('user_delete')">
	<s:a href="%{deleteProfileUrlId}"
		title="%{getText('profile.deleteProfile')}">
		<img src="image/icons/0049_trash.png" width="24" height="24"
			alt="delete" border="0" onclick="return ask_first(this);"></img>
	</s:a>
</s:if></div>
</div>

<table class="green">
	<tr>
		<th width="25%"><s:text name="userBean.firstName"></s:text></th>
		<td><s:property value="profileBean.firstName" /></td>
	</tr>
	<tr>
		<th><s:text name="userBean.lastName"></s:text></th>
		<td><s:property value="profileBean.lastName" /></td>
	</tr>
	<tr>
		<th><s:text name="userBean.email"></s:text></th>
		<td><s:property value="profileBean.email" /></td>
	</tr>
	<tr>
		<th><s:text name="userBean.password"></s:text></th>
		<td><s:property value="profileBean.password" /></td>
	</tr>
</table>
<br />

<h2><s:text name="profile.openPayments.toPay"></s:text></h2>

<table class="green">
	<thead>
		<tr>
			<th>ID</th>
			<th>Event</th>
			<th><s:text name="profile.payment.to"></s:text></th>
			<th><s:text name="profile.payment.value"></s:text></th>
			<th><s:text name="profile.payment.paid"></s:text></th>
			<th><s:text name="profile.payment.received"></s:text></th>
		</tr>
	</thead>
	<tbody>
		<s:iterator value="toPayList">
			<%--Links zu Event, Debitor/Debtee erzeugen --%>
			<s:url action="showEvent" namespace="/" var="showEventUrlId">
				<s:param name="eventId"><s:property value="eventBean.eventId"></s:property></s:param>
			</s:url>
			<s:url action="profileInput" namespace="/" var="showDebteeUrlId">
				<s:param name="userId"><s:property value="debtee.userId"></s:property></s:param>
			</s:url>
			<%--Links zu Zahlungs-Update erzeugen --%>
			<s:url action="updatePaymentStatus" namespace="/" var="updatePaymentSentUrlId">
				<s:param name="paymentId"><s:property value="paymentId"></s:property></s:param>
				<s:param name="updateMode">sent</s:param>
			</s:url>
			<s:url action="updatePaymentStatus" namespace="/" var="updatePaymentNotSentUrlId">
				<s:param name="paymentId"><s:property value="paymentId"></s:property></s:param>
				<s:param name="updateMode">notsent</s:param>
			</s:url>
			<s:url action="updatePaymentStatus" namespace="/" var="updatePaymentReceivedUrlId">
				<s:param name="paymentId"><s:property value="paymentId"></s:property></s:param>
				<s:param name="updateMode">received</s:param>
			</s:url>
			<s:url action="updatePaymentStatus" namespace="/" var="updatePaymentNotReceivedUrlId">
				<s:param name="paymentId"><s:property value="paymentId"></s:property></s:param>
				<s:param name="updateMode">notreceived</s:param>
			</s:url>
			<tr>
				<td><s:property value="paymentId"></s:property></td>
				<td><s:a href="%{showEventUrlId}"><s:property value="eventBean.eventName"></s:property></s:a></td>
				<td>
				
				<s:if test="#session.loginToken.rights.contains('user_list')">
				<s:a href="%{showDebteeUrlId}"><s:property value="debtee.email"></s:property></s:a>
				</s:if><s:else>
					<s:property value="debtee.email"></s:property>
				</s:else>
				
				
				</td>
				<td><s:property value="paymentValue"></s:property> &euro;</td>
				<td>
					
						<s:if test="paymentPaid == false">
							<s:a href="%{updatePaymentSentUrlId}" title="%{getText('payment.markAsSent')}">
								<img src="image/icons/0008_minus.png" width="24" height="24"
									alt="edit" border="0">
							</s:a>
						</s:if><s:else>
							<s:a href="%{updatePaymentNotSentUrlId}" title="%{getText('payment.markAsNotSent')}">
								<img src="image/icons/0007_tick.png" width="24" height="24"
							alt="edit" border="0">
							</s:a>
						</s:else>
					
				</td>
				<td>
					<s:if test="#session.loginToken.rights.contains('event_edit_payment_status')">
						<s:if test="paymentReceived == false">
							<s:a href="%{updatePaymentReceivedUrlId}" title="%{getText('payment.markAsReceived')}">
								<img src="image/icons/0008_minus.png" width="24" height="24"
									alt="edit" border="0">
							</s:a>
						</s:if><s:else>
							<s:a href="%{updatePaymentNotReceivedUrlId}" title="%{getText('payment.markAsNotReceived')}">
								<img src="image/icons/0007_tick.png" width="24" height="24"
							alt="edit" border="0">
							</s:a>
						</s:else>
					</s:if><s:else>
						<s:if test="paymentReceived == false">
							<img src="image/icons/0008_minus.png" width="24" height="24"
									alt="edit" border="0">
							
						</s:if><s:else>
								<img src="image/icons/0007_tick.png" width="24" height="24"
							alt="edit" border="0">
						</s:else>					
					</s:else>
				</td>
			</tr>		
		</s:iterator>
	</tbody>

</table>

<h2><s:text name="profile.openPayments.toReceive"></s:text></h2>

<table class="green">
	<thead>
		<tr>
			<th>ID</th>
			<th>Event</th>
			<th><s:text name="profile.payment.from"></s:text></th>
			<th><s:text name="profile.payment.value"></s:text></th>
			<th><s:text name="profile.payment.paid"></s:text></th>
			<th><s:text name="profile.payment.received"></s:text></th>
		</tr>
	</thead>
	<tbody>
		<s:iterator value="toReceiveList">
			<%--Links zu Event, Debitor/Debtee erzeugen --%>
			<s:url action="showEvent" namespace="/" var="showEventUrlId">
				<s:param name="eventId"><s:property value="eventBean.eventId"></s:property></s:param>
			</s:url>
			<s:url action="profileInput" namespace="/" var="showDebitorUrlId">
				<s:param name="userId"><s:property value="debitor.userId"></s:property></s:param>
			</s:url>
			<%--Links zu Zahlungs-Update erzeugen --%>
			<s:url action="updatePaymentStatus" namespace="/" var="updatePaymentSentUrlId">
				<s:param name="paymentId"><s:property value="paymentId"></s:property></s:param>
				<s:param name="updateMode">sent</s:param>
			</s:url>
			<s:url action="updatePaymentStatus" namespace="/" var="updatePaymentNotSentUrlId">
				<s:param name="paymentId"><s:property value="paymentId"></s:property></s:param>
				<s:param name="updateMode">notsent</s:param>
			</s:url>
			<s:url action="updatePaymentStatus" namespace="/" var="updatePaymentReceivedUrlId">
				<s:param name="paymentId"><s:property value="paymentId"></s:property></s:param>
				<s:param name="updateMode">received</s:param>
			</s:url>
			<s:url action="updatePaymentStatus" namespace="/" var="updatePaymentNotReceivedUrlId">
				<s:param name="paymentId"><s:property value="paymentId"></s:property></s:param>
				<s:param name="updateMode">notreceived</s:param>
			</s:url>
			<tr>
				<td><s:property value="paymentId"></s:property></td>
				<td><s:a href="%{showEventUrlId}"><s:property value="eventBean.eventName"></s:property></s:a></td>
				<td>
				<s:if test="#session.loginToken.rights.contains('user_list')">
					<s:a href="%{showDebteeUrlId}"><s:property value="debitor.email"></s:property></s:a>
				</s:if><s:else>
					<s:property value="debitor.email"></s:property>
				</s:else>
				</td>
				<td><s:property value="paymentValue"></s:property> &euro;</td>
				<!-- Zahlung gesendet -->
				<td>
					<s:if test="#session.loginToken.rights.contains('event_edit_payment_status')">
						<s:if test="paymentPaid == false">
							<s:a href="%{updatePaymentSentUrlId}" title="%{getText('payment.markAsSent')}">
								<img src="image/icons/0008_minus.png" width="24" height="24"
									alt="edit" border="0">
							</s:a>
						</s:if><s:else>
							<s:a href="%{updatePaymentNotSentUrlId}" title="%{getText('payment.markAsNotSend')}">
								<img src="image/icons/0007_tick.png" width="24" height="24"
							alt="edit" border="0">
							</s:a>
						</s:else>
					</s:if><s:else>
						<s:if test="paymentSent == false">
							<img src="image/icons/0008_minus.png" width="24" height="24"
									alt="edit" border="0">
							
						</s:if><s:else>
								<img src="image/icons/0007_tick.png" width="24" height="24"
							alt="edit" border="0">
						</s:else>					
					</s:else>
				</td>
				
				<!-- Zahlung erhalten -->
				<td>
					<s:if test="paymentReceived == false">
						<s:a href="%{updatePaymentReceivedUrlId}" title="%{getText('payment.markAsReceived')}">
							<img src="image/icons/0008_minus.png" width="24" height="24"
								alt="edit" border="0">
						</s:a>
					</s:if><s:else>
						<s:a href="%{updatePaymentNotReceivedUrlId}" title="%{getText('payment.markAsNotReceived')}">
							<img src="image/icons/0007_tick.png" width="24" height="24"
								alt="edit" border="0">
						</s:a>
					</s:else>
				</td>
			</tr>		
		</s:iterator>
	</tbody>

</table>


<br/>


<%-- Tabellen mit Rollen und Rechten 
<table width="60%" class="green">
	<tr>
		<th><s:text name="profile.rolesHeader" /></th>
	</tr>
	<s:iterator value="profileBean.roleList" var="role">
		<tr>
			<td><s:property value="role" /></td>
		</tr>
	</s:iterator>
</table>
<br />
<table width="60%" class="green">
	<tr>
		<th><s:text name="profile.rightsHeader" /></th>
	</tr>
	<s:iterator value="profileBean.rights" var="right">
		<tr>
			<td><s:property value="right" /></td>
		</tr>
	</s:iterator>
</table>
--%>